#include <stdio.h>
int TimeIsValid(int
hour, int minute, double second)
{
	if(hour>=0&&hour<24&&minute>=0&&minute<60&&second>=0&&second<60)
	return 1;
	else
	return 0;
}


int main()
{
    int hour = -1, minute = -1;
    double second = -1.0;
    scanf("%d:%d:%lg", &hour, &minute, &second);
    if (TimeIsValid(hour, minute, second))
    {
        puts("Yes");
    }
    else
    {
        puts("No");
    }
    return 0;
}
